#ifndef __INI_H__
#define __INI_H__

#include "uid.h"

#define INI_ERROR_NONE              0
#define INI_ERROR_INVALID_STATE     -1
#define INI_ERROR_MISSING_VALUE     -2
#define INI_ERROR_PARSE_ERROR       -3
#define INI_ERROR_INVALID_SECTION   -4
// add your own errors

#define INI_TYPE_VOID       0
#define INI_TYPE_INTEGER    1
#define INI_TYPE_FLOAT      2
#define INI_TYPE_STRING     3
#define INI_TYPE_BOOLEAN    4




void            iniSelect (uid_t) ; // select ini container
void            iniParseLump (char const * inidata) ; // parse a lump of ini text into the current container
void            iniParseFile (char const * filename) ; // parse a file into the current container
void            iniDispose () ; // dipose of current container

int             iniGetType (char const * section,char const * value) ;      // returns type of value , or void if not present
int             iniGetInt (char const * section,char const * value) ;       // returns integer value if possible, else result is undefined
double          iniGetFloat (char const * section,char const * value) ;     // returns float value if possible, else result is undefined
int             iniGetBool  (char const * section,char const * value) ;     // returns bool value (0 if false and non 0 if true) if possible , else result is undefined
char const *    iniGetString (char const * section,char const * value) ;    // returns string value if possible , else result is undefined
                                                                            // NOTE: string value isn't not mutable by the caller and is
                                                                            // property of the container and is deallocated
                                                                            // when dispose is called
                                                                            
int             iniLastErrorId () ;                     // error id , INI_ERROR_NONE for no error
size_t          iniLastErrorSize () ;                   // size of error message 0 , if no error message available
void            iniLastErrorMessage (char *,size_t) ;   // first size_t of error message including terminator


#endif
